package com.woniuxy.pxxt.dao;

import com.woniuxy.pxxt.common.vo.CourseEditVo;
import com.woniuxy.pxxt.common.vo.CourseEttVo;
import com.woniuxy.pxxt.common.vo.UserTrainAndCourseMsgVo;
import com.woniuxy.pxxt.dto.ManagerPersonAllDto;
import com.woniuxy.pxxt.dto.UserMsgDtoSkc;
import com.woniuxy.pxxt.dto.user.UserTrainAndCourseMsgDtoSkc;
import com.woniuxy.pxxt.entity.User;
import com.woniuxy.pxxt.entity.UserScore;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
import com.woniuxy.pxxt.entity.User_Role;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Interface
 * <P> TODO:
 * <P> Date: 2022/3/7:13:19
 * <P> Description:
 */

public interface UserDao {
    User findById(Integer id);


    /**
     * <P>Author ideaAdmin
     * <P>TODO: 查找用户角色
     * <P>Date 14:29 2022/3/12
     * <P>* @param userId
     * <P>* @return com.woniuxy.pxxt.dto.UserMsgDtoSkc
     **/
    UserMsgDtoSkc findUserMsg(Integer userId);

    List<ManagerPersonAllDto> findManagerPerson();

    int updateUserById(UserMsgDtoSkc userMsgDtoSkc);

    /**
     * <P>Author ideaAdmin
     * <P>TODO: 通过vo对象来查询
     * <P>Date 11:06 2022/3/11
     * <P>* @param userTrainAndCourseMsgVo
     * <P>* @return java.util.List<com.woniuxy.pxxt.dto.user.UserTrainAndCourseMsgDtoSkc>
     **/
    List<UserTrainAndCourseMsgDtoSkc> getUserAllMsg(UserTrainAndCourseMsgVo userTrainAndCourseMsgVo);

    /**
     * <P>Author ideaAdmin
     * <P>TODO: 根据课程id 查看这个用户是否是参与了这个课程
     * <P>Date 15:55 2022/3/11
     * <P>* @param id 培训id
     * <P>@param userId 用户id
     * <P>* @return com.woniuxy.pxxt.entity.UserScore
     **/
    UserScore findTrainByTrainId(@Param("trainId") Integer trainId,
                                 @Param("userId") Integer userId);

    /**
     * <P>Author ideaAdmin
     * <P>TODO: 根据账号查找用户
     * <P>Date 14:31 2022/3/12
     * <P>* @param account
     * <P>* @return com.woniuxy.pxxt.entity.User
     **/
//    @Cacheable(cacheNames = "cache_user", key="'user_' + #user.id")
    User findByAccount(User user);

     int addOne(UserMsgDtoSkc userMsgDtoSkc);

    /**
     * <P>Author ideaAdmin
     * <P>TODO: 新增学员权限
     * <P>Date 15:06 2022/3/14
     * <P>* @param userId
     * <P>* @return int
     **/
     int addUserRole(User_Role user_role);

    /**
     * <P>Author ideaAdmin
     * <P>TODO: 查询学员课程
     * <P>Date 15:06 2022/3/14
     * <P>* @param userId
     * <P>* @return List<com.woniuxy.pxxt.common.vo.CourseEditVo>
     **/
    List<CourseEditVo> findCourseById(Integer userId);

    CourseEditVo findCourse(int id);

    List<CourseEttVo> findSomeCourse(CourseEttVo courseEttVo);
}

